package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.lite.util.ContextUtil;
import ezy.lite.util.DateTime;
import ezy.lite.util.UI;
import ezy.widget.view.AutofitImageView;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Calculate;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Integral;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.main.Home;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.LifeShopActivity;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.PanicBuyDetailActivity;

/**
 * Created by Administrator on 2016/4/26 0026.
 */
public class CalculateAdapter extends ItemAdapter<Calculate, CalculateAdapter.CalculateViewHolder> {
    private Context context;

    public CalculateAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public CalculateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new CalculateViewHolder(inflate(R.layout.item_how_cal, parent));
    }

    @Override
    public void onBindViewHolder(CalculateViewHolder holder, int position) {
        Calculate item = getItem(position);
        holder.txtName.setText(item.name);
        holder.txtNumber.setText(item.number+"");
        holder.txtTime.setText(DateTime.toDateTimeMs(item.time*1000));
    }


    static class CalculateViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_time)
        TextView txtTime;
        @BindView(R.id.txt_number)
        TextView txtNumber;
        @BindView(R.id.txt_name)
        TextView txtName;

        public CalculateViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
//                    ContextUtil.startActivity(v.getContext(), LifeShopActivity.class);
                }
            });
        }

    }
}
